<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>计时器</title>
		<script type="text/javascript">
			var fYear,fMonth,fDate,fTime;
			window.onload=function(){

				fYear = document.getElementById('fYear');
				fMonth = document.getElementById('fMonth');
				fDate = document.getElementById('fDate');
				fTime = document.getElementById('fTime');
					setTimeout(timeMove,3000)
				

			
			}
		
			function timeMove(){
				date=new Date();
				fYear.innerHTML = date.getFullYear();//获取年份
				fMonth.innerHTML = date.getMonth()+1;//获取月份，0~11，所以必须加一
				fDate.innerHTML = date.getDate();//获取日期
				fTime.innerHTML = date.getHours()+":"+date.getMinutes()+":"+date.getSeconds();
				setInterval(timeMove,1000);//每秒调用一次
			}
		</script>
	</head>
	<body>

		<font  id="fYear" ></font>年<font id="fMonth"></font>月
		<font  id="fDate" ></font>日&nbsp;<font id="fTime"></font>
	</body>
</html>
